package Logic;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;

public class webInterface 
{
	// Tenho que fazer singleton aqui!
	private static webInterface instance = null;
	
	// This contructor cannot be instantiated. This is a singleton Bitch!
	private webInterface(){}
	// This method gets the instace this class
	
	public static webInterface getInstance() 
	{
		if(instance == null) 
		{
		   instance = new webInterface();
		}
		return instance;
	}
	
	// Method that returns the html
	public String getHtml(String url)throws IOException 
	{
		
		URL urlObj = new URL(url);
		BufferedReader in = new BufferedReader(new InputStreamReader(urlObj.openStream()));
		String html = "";
		String prov= "";

		while ((prov = in.readLine()) != null) 
		{
			
			// Process each line.
			html += prov;
		}
		in.close();
		return html;
	}
	
}

